11/2/2018

Introduction

Why have a website?

  • It's 2018
  • Gives people a chance to learn about you/your work without meeting in person
  • Designated place to store professional materials

Disclaimer

  • There are many other options to make a website
  • This follows Yihui Xie's book online available here

Prerequisites

  • recent version of R/Rstudio installed
  • GitHub account

Bonus points!!!!

  • recent copy of a CV (in .pdf)
  • short bio
  • picture
  • blogdown R package installed

Tutorial!!!

Installation

## Install from CRAN
install.packages("blogdown")
blogdown::install_hugo(force = TRUE) #also need Hugo
blogdown::hugo_version() ## check this returns current version

If Hugo version isn't correct

See this issue here

Essentially, go to terminal and enter (only checked for macOS):

rm -r ~/Library/Application\ Support/Hugo/
rm -r /usr/local/Cellar/hugo
rm -r /usr/local/bin/hugo
brew reinstall hugo #(or blogdown::install_hugo(force = TRUE) 
#might work ) # need homebrew for this

Building the template site

  • First make a new project
  • In RStudio: File > New Project…

Launch template site

In the new project run:

blogdown::serve_site()

Directory of your new site

The config.toml file

  • This is sort of the floorplan of your website
  • Take a few minutes let's change basic things like name, title, show how to add delete sections
  • Add photo (put image in static/img/portrait.jpg)
  • Add CV (add cv to static/files/cv.pdf and uncomment lines in config.toml)

Update website

  • Update content/home/about.md
  • Delete content/home/(hero stuff)
  • Go to R and run:
file.create('public/.nojekyll') #Need this to put website on GitHub

GitHub

Login to GitHub

Make a Repo

Adding to GitHub

cd public
git init
git add .
git commit -m "First commit"

git remote add origin <paste>
git push -u origin master

Making Changes

Change files

cd public
git add . 
git commit -m "description of update"
git push

Getting webpage to stat website

ssh <username>@stat-remote.stat.wisc.edu
cd public/html
nano index.html

copy and paste this into your editor:

<meta http-equiv="refresh" content="0; 
url=https://<github-username>.github.io" />

<p><a href="https://<github-username>.github.io">Redirect</a></p>

save file and visit stat.wisc.edu/~[stat-username]

CONGRATULATIONS!!